<template>
    <div>
        <input type="text"  v-model="form.name" ><br>
        <select v-model="form.cate">
            <option v-for="i in cate">{{i.name}}</option>
        </select><br>
        <button @click="add">提交</button>
    </div>
</template>

<script>
    export default {
        data(){
            return{
                form:{},
                cate:[]
            }
        },
        methods:{
            get_cate(){
                this.$axios.get('cate').then(res=>{
                    this.cate = res.data.list
                })
            },
            add(){
                this.$axios.post('good',this.form).then(res=>{
                    alert('添加成功')
                })
            }
        },
        mounted(){
            this.get_cate()
        }
    }
</script>

<style scoped>

</style>